package com.itheima;
/*英文绕口令
        peter piper picked a peck of pickled peppers
        统计这段绕口令有多少个以p开头的单词*/
public class Statistics {
    public static void main(String[] args) {
        String str = "peter piper picked a peck of pickled peppers";
        int count = 0;
        if (str.contains(" ")) {
            String [] parts = str.split(" ");
            for (int i = 0; i < parts.length; i++) {
                System.out.println(parts[i]);
                String sb = String.valueOf(parts[i].charAt(0));
                System.out.println(sb);
                if(sb.equals("p")){
                    count++;
                }
            }
        }
        System.out.println("一共有"+count+"个以p为开头的单词");
    }
}
